package com.company4.students;

import java.util.List;
import java.util.Scanner;

public class delstudent {
    public static void deleteStudent(Scanner sc, List<student> listStudents) {
        System.out.println("输入需要删除的id");
        int id = sc.nextInt();
        for (student student : listStudents) {
            int index = listStudents.indexOf(student);
            if (id == student.getId()) {
                listStudents.remove(index);
                System.out.printf("%d删除成功\n", student.getId());
            }
        }
    }
}
